<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div class="box">
        hello div
        <p class="post">
            hello p1
            <b id="btag">!!</b>
        </p>
    </div>

    <script>

        const btag = document.getElementById('btag');
        console.log(btag.matches('p b'));
        console.log(btag.matches('.box .post b'));
        console.log(btag.matches('.box b'));
        console.log(btag.matches('.box > b'));

    </script>
</body>

</html>